package com.wpc.smspringmvc.test;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.wpc.smspringmvc.model.User;
import com.wpc.smspringmvc.service.impl.UserServiceImpl;

public class UserServiceText {

	@Test
	public void addUserTest() throws Exception {
	
	ApplicationContext apct = new ClassPathXmlApplicationContext("spring/spring.xml");
	UserServiceImpl  userService = apct.getBean(UserServiceImpl.class);
	
	User user = new User();
	
	user.setName("李四");
	user.setAge(18);
	user.setSex("男");
	
	int rownum =userService.addUser(user);
	System.out.println("影响的行数："+rownum+"行");
	
	}
}
